<extend name="Base/common"/>

<block name="style">
    <link href="__CSS__/event.css" rel="stylesheet" type="text/css"/>
    <link type="text/css" rel="stylesheet" href="__STATIC__/oneplus/js/ext/magnific/magnific-popup.css"/>
</block>

<block name="body">



<div class="row">
    <div class="col-md-12">

        <nav class="navbar navbar-default app_block event_navbar forum_module container_nav" role="navigation">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse"
                        data-target="#bs-example-navbar-collapse-1" style="margin-top: 0px;">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class=" collapse navbar-collapse " id="bs-example-navbar-collapse-1"
                 style="  border-color: #fff;background: #FFFFFF;overflow-y: inherit;z-index: 99;">
                <!--二级导航-->
                <ul class="container_nav_tab" style="margin-top: 5px;">
                    <div class="col-md-4">
                        <li class="container_nav_tab_li active col-xs-4 col-md-4">
                            <a href="{:U('index')}">活动首页</a>
                        </li>
                        <li class="container_nav_tab_li col-xs-4 col-md-4">
                            <a href="{:U('myevent')}">我的活动</a>
                        </li>
                    </div>
                    <li class="pull-right">

                        <if condition="is_login() eq 0">
                            <button class="btn btn-primary event_btn" onclick="op_error('请登陆后再投稿。','温馨提示')"><i
                                    class="glyphicon glyphicon-send"></i>&nbsp;发起活动
                            </button>
                            <else/>
                            <a class="btn btn-primary event_btn" href="{:U('Event/Index/add')}"><i
                                    class="glyphicon glyphicon-send"></i>&nbsp;发起活动
                            </a>

                        </if>

                    </li>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </nav>
    </div>
</div>




<div class="row">

    <div class="col-md-4 pull-right" style="z-index: 99">
        <div class="forum_module event_right">
            <h2 class="event_type_name">活动分类</h2>

            <div class="event_type">
                <a style="float: left" href="{:U('index',array('norh'=>$norh))}"
                <eq name="type_id" value="">class="cur"</eq>
                >全部分类</a>
                <volist name="tree" id="top">
                    <a style="float: left"
                    <eq name="type_id" value="$top['id']">class="cur"</eq>
                    href="{:U('index',array('type_id'=>$top['id'],'norh'=>$norh))}" data="{$top.id}">{$top.title}</a>
                </volist>
            </div>
        </div>






        <div class="forum_module " style="width: 345px;float: left;">
            <h2 class="event_type_name">参与活动的人 ({$content.attentionCount}人) <a class="pull-right"
                                                                               href="{:U('member',array('id'=>$content['id']))}"
                                                                               style="font-size: 16px;margin-right: 10px;color: #3d3d3d">全部</a>
            </h2>

            <div style="width: 100%">
                <volist name="content['member']" id="vo" offset="0" length="20">
                    <div class="" style="text-align: center;width:80px;float: left;height: 80px;line-height: 80px;">
                        <a href="{$vo.space_url}">
                            <img ucard="{$vo.id}" src="{$vo.avatar64}" class="avatar-img" style="width: 64px"/>
                        </a>
                    </div>
                </volist>
            </div>

        </div>


        <h2 style="font-size: 16px;"> 推荐活动</h2>

        <volist name="rec_event" id="vo">
            <div class="forum_module event_right " style="padding: 0 0 10px 0;">

                <a class="pull-left" href="{:U('Event/Index/detail',array('id'=>$vo['id']))}"> <img
                        class="cover img-responsive"
                        src="{$vo.cover_id|getThumbImageById=345,233}"/></a>

                <div class="pull-left" style="width: 100%;">
                    <div class="mgl20 event_title"><a href="{:U('Event/Index/detail',array('id'=>$vo['id']))}"
                                                      class="text-more" style="width: 100%">{$vo.title}</a></div>
                    <div class="event_fq_count pull-left">
                        <div class="pull-left mgb10 col-md-12">
                            <div class="pull-left col-md-6" style="padding-left: 5px;">by&nbsp; <a class=""
                                                                                                   href="{$vo.user.space_url}">
                                <span class="event_count">{$vo.user.nickname}</span></a></div>
                            <div title="报名人数" class=" pull-left col-md-3">
                                <div class="event_logo" style=""></div>
                                <span class="event_count">&nbsp;{$vo.signCount}人</span></div>
                            <div class=" pull-left col-md-3">
                                <div class="event_logo" style="background-position: -20px 0px;"></div>
                                <span class="event_count">&nbsp;{$vo.view_count}</span></div>
                        </div>

                        <div class="pull-left mgb10">
                            <div class="pull-left mgl20 " style="font-size: 14px;">时间：
                                {:date('Y-m-d',$vo['sTime'])}--{:date('Y-m-d',$vo['eTime'])} &nbsp;&nbsp;
                                {$vo.type.title}
                            </div>
                        </div>
                        <div class="pull-left mgl20 word-wrap" style="width: 90%">简介：
                            {$vo.explain|op_h='font'|getShortSp=45}
                        </div>

                    </div>
                </div>

            </div>
        </volist>
    </div>


    <div class="col-md-8">

        <div class="forum_module pull-left" style="width: 100%; min-height: 500px;padding: 0;">
            <div class="clearfix">
                <div style="padding: 17px 0 0 10px;">
                    <if condition="time() lt $content['eTime']">
                        <div class="event_state" style="background: #d61f39;">
                            正在进行
                        </div>
                        <else/>
                        <div class="event_state" style="background: #000;">
                            已结束
                        </div>
                    </if>
                    <a class="pull-left" href="javascript:" onclick="location.href='{:U('Event/Index/detail',array('id'=>$content['id']))}'">
                        <img class="cover img-responsive" src="{$content.cover_id|getThumbImageById=345,250}"/>

                        <div class="event_detail_type">{$content.type.title}</div>
                    </a>
                </div>
                <div class="pull-left col-xs-12 col-md-6" >
                    <div class="mgl20 event_title"><a href="javascript:" onclick="location.href='{:U('Event/Index/detail',array('id'=>$content['id']))}'"
                                                      class="text-more" style="width: 85%;float: left"
                                                      title="{$content.title}">{$content.title}</a>

                        <div style="float: left;margin-top: 5px;">
                            <div class="event_logo" style="background-position: -20px 0px;"></div>
                            <span class="event_count">&nbsp;{$content.view_count}</span>
                        </div>
                    </div>
                    <div class="event_fq_count pull-left">
                        <p>

                        <div class="pull-left mgl20" style="width: 100%;font-size: 14px;">发起人：&nbsp; <a class=""
                                                                                                        href="{$content.user.space_url}">
                            <span class="event_count">{$content.user.nickname}</span></a></div>
                        </p>

                        <p>

                        <div class="pull-left mgl20 mgt10 " style="font-size: 14px;width: 100%">时间：
                            {:date('Y-m-d',$content['sTime'])}--{:date('Y-m-d',$content['eTime'])}
                        </div>
                        </p>

                        <p>

                        <div class="pull-left mgl20 mgt10 " style="font-size: 14px;width: 90%">地点：
                            {$content.address}
                        </div>
                        </p>

                        <p>

                        <div class="pull-left mgl20 mgt10 " style="font-size: 14px;width: 100%">截止时间：
                            {:date('Y-m-d H:i',$content['deadline'])}
                        </div>
                        </p>

                        <div class="pull-left clearfix" style="width: 100%">
                            <div class=" pull-left mgl20 mgt10">
                                <span class="event_count">人数限制：&nbsp; {$content.limitCount}人</span>
                            </div>


                            <div class=" pull-left  mgl20 mgt10">
                                <span class="event_count">已报名：&nbsp;{$content.signCount}人</span>
                            </div>

                            <div class=" pull-left  mgl20 mgt10">
                                <span class="event_count">已参加：&nbsp;{$content.attentionCount}人</span>
                            </div>
                        </div>
                        <div class="pull-left mgl20 mgt10">
                            <div class="btn-group">

                                <php>if($content['uid'] == is_login() || is_administrator(is_login())){</php>

                                <if condition="time() lt $content['eTime']">
                                    <a id="endEvent" class="btn btn-default">提前结束</a>
                                </if>

                                <a href="{:U('edit',array('id'=>$content['id']))}" class="btn btn-default">编辑活动</a>
                                <a id="delEvent" class="btn btn-default">删除活动</a>
                                <php>}if($content['uid'] != is_login() || is_administrator(is_login())){</php>
                                <php>if(!$check_isSign){</php>
                                <php>if($vo['deadline'] < time()){</php>
                                <a class="btn btn-default  " href="javascript:"
                                   onclick="op_error('报名已截止')">报名已截止 </a>
                                <php>}else{</php>
                                <if condition="is_login() eq 0">
                                    <a class="btn  btn-info   " href="javascript:"style="color: #fff"
                                       onclick="op_error('请登陆后再报名')">报名参加 </a>
                                    <else/>
                                    <a class="btn  btn-info  event_sign "style="color: #fff"
                                       href="{:U('ajax_sign',array('event_id'=>$vo['id']))}">报名参加 </a>
                                </if>
                                <php>}</php>
                                <php>}else{</php>
                                <a class="btn btn-default" href="javascript:"
                                   id="unSign">取消报名 </a>

                                <span style="line-height: 34px;"> 已报名&nbsp;&nbsp;&nbsp;&nbsp;<if
                                        condition="$check_isSign[0]['status'] eq 1">已审核
                                    <else/>
                                    未审核
                                </if></span>
                                <php>}
                                    }</php>



                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div style="font-size: 16px;padding: 30px 0 10px 30px;">活动详情</div>
            <div class="word-wrap" style="padding: 5px 20px 50px 20px;">
                {$content.explain}

                <div class="pull-right" style="color: #999">
                    发布时间： {$content.create_time|friendlyDate} &nbsp;&nbsp;
                    更新时间： {$content.update_time|friendlyDate}
                </div>

            </div>


            <div class="clearfix"></div>
            <div style="padding: 5px 20px 50px 20px;">
                {:hook('localComment', array('path'=>"Event/event/$content[id]", 'uid'=>$content['uid']))}
            </div>

        </div>
    </div>
</div>

</block>

<block name="script">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript" src="__STATIC__/oneplus/js/ext/magnific/jquery.magnific-popup.min.js"></script>
    <script>
        $(function () {
            $('#top_nav >li >a ').mouseenter(function () {
                $('.children_nav').hide();
                $('#children_' + $(this).attr('data')).show();
            });


            $('.event_sign').magnificPopup({
                type: 'ajax',
                overflowY: 'scroll',
                modal: true,
                callbacks: {
                    ajaxContentAdded: function () {
                        console.log(this.content);
                    }
                }
            });


            bindSupport();
            /**
             * 取消报名
             * */
            $('#unSign').click(function () {
                if (confirm('确定要取消报名么？')) {
                    var event_id = "{$content['id']}";
                    $.post("{:U('Event/Index/unSign')}", {event_id: event_id}, function (res) {
                        if (res.status) {
                            op_success(res.info);
                            setTimeout(function () {
                                location.reload();
                            }, 1500);
                        }
                        else {
                            op_error(res.info);
                        }
                    }, 'json');
                }
            });
            /**
             * 删除活动事件
             * */
            $('#delEvent').click(function () {
                if (confirm('确定要删除活动么？')) {
                    var event_id = "{$content['id']}";
                    $.post("{:U('Event/Index/doDelEvent')}", {event_id: event_id}, function (res) {
                        if (res.status) {
                            op_success(res.info);
                            setTimeout(function () {
                                location.href = "{:U('index')}";
                            }, 1500);
                        }
                        else {
                            op_error(res.info);
                        }
                    }, 'json');
                }
            });
            /**
             * 提前结束活动点击事件
             */
            $('#endEvent').click(function () {
                if (confirm('确定要提前结束活动么？')) {
                    var event_id = "{$content['id']}";
                    $.post("{:U('Event/Index/doEndEvent')}", {event_id: event_id}, function (res) {
                        if (res.status) {
                            op_success(res.info);
                            setTimeout(function () {
                                location.reload();
                            }, 1500);
                        }
                        else {
                            op_error(res.info);
                        }
                    }, 'json');
                }
            });
        })
    </script>

</block>

